function getCurrentTime() {
    var myDate = new Date;
    var year = myDate.getFullYear(); //获取当前年
    var mon = myDate.getMonth() + 1; //获取当前月
    mon = mon<10?"0"+mon : mon;
    var date = myDate.getDate(); //获取当前日
    date = date<10?"0"+date : date;
    var h = myDate.getHours();//获取当前小时数(0-23)
    h = h<10?"0"+h : h;
    var m = myDate.getMinutes();//获取当前分钟数(0-59)
    m = m<10?"0"+m : m;
    var s = myDate.getSeconds();//获取当前秒
    s = s<10?"0"+s : s;
    var week = myDate.getDay();
    var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
    console.log(year, mon, date, weeks[week])
    var currentTime = year + "-" + mon + "-" + date + " " +  h  + ":" + m + ":" + s;
    $("#currentTime").val(currentTime);
}

function resetData() {
    window.location.href='#addOrUpdate';
    $("#id").val("");
    $("#QRCode").val("");
    $("#testValue").val("");
    getCurrentTime();
}

function del() {
    alert("刪除成功");
}

function update(id, QRCode, currentTime, testValue){
    // $("#update").css("display","block");
    window.location.href='#addOrUpdate';
    $("#id").val(id);
    $("#QRCode").val(QRCode);
    $("#currentTime").val(currentTime);
    $("#testValue").val(testValue);
}

function findByPage(type) {
    var url = "";
    var model = $("#model").val();
    var basePath = $("#basePath").val();
    var currPage = Number($("#currPage").val());
    var lastPage = Number($("#lastPage").val());
    if (model=='makeRegiseter') {
        url = basePath + "makeRegister/showMakeRegister"
    } else if (model="payStandard") {
        url = basePath + "payStandard/show"
    } else if (model="payDetail") {
        url = basePath + "payDetail/show"
    }
    if(type=='up') {
        if(currPage > 1) {
            currPage = currPage - 1;
        } else {
            currPage = 1;
        }
    } else if (type=='next') {
        if(lastPage > 1 && currPage < lastPage) {
            currPage = currPage + 1;
        } else {
            currPage = 1;
        }
    } else if (type=='last') {
        currPage = lastPage;
    } else if (type=='index') {
        currPage = 1;
    }
    window.location.href = url + "?currPage=" + currPage;
}

// 缴费
function jf(memberId, roCharge, roId, basePath) {
    $.ajax({
        type: "GET",
        async: false,
        url: basePath + "payDetail/add",
        data: {
            memberId: memberId,
            paymentAmount: roCharge,
            roId: roId
        },
        success: function(data) {
            if(data==200) {
                alert("缴费成功");
            } else {
                alert("缴费失败");
            }
        },
        error: function (data) {
            alert("缴费失败");
        }
    })
    window.location.reload()
}